package boot.lijf.web.web;

import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Map;
import java.util.Properties;

@org.springframework.web.bind.annotation.RestController
public class RestController {

    @RequestMapping("")
    public Map<String,String> env(HttpServletRequest request) throws IOException {
        HttpSession session = request.getSession();
        session.invalidate();
        File file = new File("asdf");
        file.createNewFile();
        URI uri = file.toURI();
        System.out.println(uri);
        System.out.println(file.getPath());
//        System.out.println(Files.createFile(Paths.get("asdf.mmd")).toUri());

        return System.getenv();
    }

    @RequestMapping("prop")
    public Properties prop(HttpServletRequest request) throws IOException {

        return System.getProperties();
    }
}
